package com.wjh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjh.constants.SystemConstants;
import com.wjh.enums.AppHttpCodeEnum;
import com.wjh.exception.SystemException;
import com.wjh.mapper.RoleMapper;
import com.wjh.pojo.Role;
import com.wjh.service.RoleService;
import com.wjh.utils.BeanCopyUtils;
import com.wjh.utils.ResponseResult;
import com.wjh.vo.AdminRoleVo;
import com.wjh.vo.PageVo;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 角色表(Role)表服务实现类
 *
 * @author makejava
 * @since 2023-03-17 13:15:51
 */
@Service("roleService")
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Override
    public List<String> selectRolesById(Integer id) {
        //判断是否是管理员
        List<String> roleKey = new ArrayList<>();
        if(id == 1L){
            roleKey.add(SystemConstants.ADMIN);
            return roleKey;
        }
        //否则查询用户所具有的角色信息
        return getBaseMapper().selectRolesById(id);
    }

}
